package Volume1.ch9;

import java.util.Comparator;
import java.util.NavigableSet;
import java.util.SortedSet;
import java.util.TreeSet;

/**
 * @Auther jacob
 * @Date 2020/8/15 00:49
 */
public class TreeSetTest {
    public static void main(String[] args) {
        SortedSet parts = new TreeSet();
        parts.add(new Item("a", 789));
        parts.add(new Item("b", 456));
        parts.add(new Item("c", 789));
        System.out.println(parts);

        NavigableSet<Item> sortByDesc = new TreeSet<>(Comparator.comparing(Item::getDesc));
        sortByDesc.addAll(parts);
        System.out.println(sortByDesc);

    }
}
